import React from 'react';
import ReactDOM from 'react-dom/client';
import './index.css';
import App from './App';
import reportWebVitals from './reportWebVitals';
import {
    BrowserRouter, Route, Routes,
} from "react-router-dom";
import Album from "./pages/Album";
import About from "./pages/About";
import LasyTest from "./pages/LasyTest";
import ContextTest from "./pages/ContextTest";
import GlobalErrorBoundary from "./pages/components/GlobalErrorBoundary";
import RefTest from "./pages/RefTest/RefTest";
import FunctionalRefTest from "./pages/RefTest/FunctionalRefTest";

const root = ReactDOM.createRoot(document.getElementById('root'));
root.render(
    <React.StrictMode>
        <GlobalErrorBoundary>
            <BrowserRouter>
                <Routes>
                    <Route path="/" element={<App/>}>
                        <Route index element={<About/>}/>
                        <Route path="about" element={<About/>}/>
                        <Route path="lasy" element={<LasyTest/>}/>
                        <Route path="context" element={<ContextTest/>}/>
                        <Route path="ref" element={<FunctionalRefTest/>}/>
                        <Route path="album" element={<Album/>}>
                            <Route path=":albumId" element={<Album/>}/>
                        </Route>
                        <Route
                            path="*"
                            element={
                                <main>
                                    <p>There's nothing here!</p>
                                </main>
                            }
                        />
                    </Route>
                </Routes>
            </BrowserRouter>
        </GlobalErrorBoundary>
    </React.StrictMode>
);

// If you want to start measuring performance in your app, pass a function
// to log results (for example: reportWebVitals(console.log))
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
reportWebVitals();
